/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package JFreeChartExtensions.chartextensions;

import JFreeChartExtensions.ExtendableChartPanel;
import JFreeChartExtensions.containers.InternalFrameWithChart.InternalFrameWithChart;
import JFreeChartExtensions.exceptions.ExtensionLauncherException;
import java.util.LinkedList;
import java.util.List;
import javax.swing.JMenuItem;
import org.jfree.chart.ChartPanel;

/**
 *
 * @author Nobody
 */
public abstract class AbstractChartPanelExtension {

    protected IChartExtensionManager chartExtensionManager;
    protected List<JMenuItem> menuItemList = new LinkedList<JMenuItem>();
    protected ExtendableChartPanel chartPanel;
    protected String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    
    public AbstractChartPanelExtension(ExtendableChartPanel panel) {
        this.chartPanel = panel;
    }


    public AbstractChartPanelExtension(ExtendableChartPanel panel, IChartExtensionManager chartExtensionManager) {
        this(panel);
        this.chartExtensionManager = chartExtensionManager;
    }

    public AbstractChartPanelExtension(ExtendableChartPanel panel, IChartExtensionManager chartExtensionManager, JMenuItem menuItem) {
        this(panel,chartExtensionManager);
        this.menuItemList.add(menuItem);
    }

    public AbstractChartPanelExtension(ExtendableChartPanel panel, IChartExtensionManager chartExtensionManager, List<JMenuItem> menuItemList) {
        this(panel,chartExtensionManager);
        this.menuItemList.addAll(menuItemList);
    }

    public void setChartExtensionManager(IChartExtensionManager chartExtensionManager) {
        this.chartExtensionManager = chartExtensionManager;
    }

    public IChartExtensionManager getChartExtensionManager() {
        return chartExtensionManager;
    }

    public void setMenuItemList(List<JMenuItem> menuItemList) {
        this.menuItemList = menuItemList;
    }
    public abstract void applyExtension(ChartPanel chartPanel) throws ExtensionLauncherException ;
    public abstract void removeExtension();
}
